package com.grow.greenhouse.config;

import com.grow.greenhouse.utils.MqttUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MqttConfig {

    @Value("${mqtt.broker.address}")
    private String brokerAddress;

    @Value("${mqtt.broker.port}")
    private int brokerPort;

    @Value("${mqtt.client.id}")
    private String clientId;

    @Value("${mqtt.username}")
    private String username;

    @Value("${mqtt.password}")
    private String password;

    @Bean
    public MqttUtil mqttUtil() {
        return new MqttUtil(brokerAddress, brokerPort, clientId, username, password);
    }

}
